package cn.jsj.memorandum.dispose;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 更新备忘录请求
 * @author LI
 *
 */
 public class UpdateMemorandum extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("备忘录更新！！");

		 //获取参数
		 cn.jsj.pojo.TblMemorandum tm=new cn.jsj.pojo.TblMemorandum();
		 tm.setMemo_id(Integer.parseInt(request.getParameter("memoId").trim()));
		 tm.setMonday(request.getParameter("Monday").trim());
		 tm.setTuesday(request.getParameter("Tuesday").trim());
		 tm.setWednesday(request.getParameter("Wednesday").trim());
		 tm.setThursday(request.getParameter("Thursday"));
		 tm.setFriday(request.getParameter("Friday").trim());
		 tm.setSaturday(request.getParameter("Saturday").trim());
		 tm.setSunday(request.getParameter("Sunday").trim());

		 //调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("赋值完成");

		 //更新备忘录
		 cn.jsj.dao.TblUpdateMemorandumDAO tupd=new cn.jsj.dao.TblUpdateMemorandumDAO();
		 int saveResult=tupd.saveOrUpdateMemorandum(tm);

		 cn.jsj.utils.SysLogger.PrintInfo("结果"+saveResult);
		 //输出流
		 java.io.PrintWriter out=response.getWriter();
		 //更新成功
		 if(saveResult==1){
			 out.println("{message:'更新成功！'}");
		 }else{
			 out.println("{message:'更新失败!'}");
		 }
		 out.flush();
		 out.close();
	}
}